﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using System.Windows.Media.Imaging;
using System.IO;

namespace Kiosk
{
    public class Mentor : INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler PropertyChanged;
        public string Name { get; set; }
        public string Pathway { get; set; }
        public string School { get; set; }
        public string ID { get; set; }
        public string College { get; set; }
        public string JobType { get; set; }
        public string FavoriteCourses { get; set; }
        public string Comments { get; set; }
        public string Location { get; set; }
        public string MentorInfo { get; set; }
        public BitmapImage ImagePath { get; set; }

        public Mentor(string aName, string aPathway, string aSchool, string aID)
        {
            this.Name = aName;
            this.School = aSchool;
            this.Pathway = aPathway;
            this.ID = aID;

            ImagePath = new BitmapImage();
            ImagePath.BeginInit();
            ImagePath.UriSource = new Uri(@"images/generic_silhouette.png", UriKind.Relative);
            ImagePath.EndInit();
        }

        public Mentor(string aName, string aPathway, string aSchool, byte[] aImagePath, string aID)
        {
            this.Name = aName;
            this.School = aSchool;
            this.Pathway = aPathway;
            this.ID = aID;

            MemoryStream stream = new MemoryStream(aImagePath);
            ImagePath = new BitmapImage();
            ImagePath.BeginInit();
            ImagePath.StreamSource = stream;
            try
            {
                ImagePath.EndInit();
            }
            catch (Exception e)
            {
                ImagePath = new BitmapImage();
                ImagePath.BeginInit();
                ImagePath.UriSource = new Uri(@"images/generic_silhouette.png", UriKind.Relative);
                ImagePath.EndInit();
            }

          //  this.ImagePath = aImagePath;
        }

        public Mentor(string aName, string aPathway, string aSchool, string aID, string aCollege, string aJobType, string aFavoriteCourses, string aLocation, string aComments)
        {
            this.Name = aName;
            this.Pathway = aPathway;
            this.School = aSchool;
            this.ID = aID;
            this.College = aCollege;
            this.JobType = aJobType;
            this.FavoriteCourses = aFavoriteCourses;
            this.Location = aLocation;
            this.Comments = aComments;

            ImagePath = new BitmapImage();
            ImagePath.BeginInit();
            ImagePath.UriSource = new Uri(@"images/generic_silhouette.png", UriKind.Relative);
            try
            {
                ImagePath.EndInit();
            }
            catch (Exception e)
            {
                ImagePath = new BitmapImage();
                ImagePath.BeginInit();
                ImagePath.UriSource = new Uri(@"images/generic_silhouette.png", UriKind.Relative);
                ImagePath.EndInit();
            }
            setMentorInformation();
        }

        public Mentor(string aName, string aPathway, string aSchool, byte[] aImagePath ,string aID, string aCollege, string aJobType, string aFavoriteCourses, string aLocation, string aComments)
        {
            this.Name = aName;
            this.Pathway = aPathway;
            this.School = aSchool;
            this.ID = aID;
            this.College = aCollege;
            this.JobType = aJobType;
            this.FavoriteCourses = aFavoriteCourses;
            this.Location = aLocation;
            this.Comments = aComments;

            MemoryStream stream = new MemoryStream(aImagePath);
            ImagePath = new BitmapImage();
            ImagePath.BeginInit();
            ImagePath.StreamSource = stream;
            try
            {
                ImagePath.EndInit();
            }
            catch (Exception e)
            {
                ImagePath = new BitmapImage();
                ImagePath.BeginInit();
                ImagePath.UriSource = new Uri(@"images/generic_silhouette.png", UriKind.Relative);
                ImagePath.EndInit();
            }
            setMentorInformation();
        }

        private void OnPropertyChanged(string info)
        {
            PropertyChangedEventHandler handler = PropertyChanged;
            if (handler != null)
            {
                handler(this, new PropertyChangedEventArgs(info));
            }
        }

        public void setMentorInformation()
        {
            MentorInfo = "Career Pathway: " + Pathway + "\n\n" +
                "Education: " + School + "\r\n\n" +
                "College: " + College + "\r\n\n" +
                "Job Type: " + JobType + "\r\n\n" +
                "Most Beneficial Courses: \r\n" + FavoriteCourses + "\r\n" +
                "Location: " + Location + "\r\n\n" +
                "Comments: " + Comments + "\r\n\n";
        }
    }


}
